package com.campus.merchant.controller;

import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.campus.common.bean.common.Resp;
import com.campus.merchant.entity.Canteen;
import com.campus.merchant.mapper.CanteenMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 * 食堂表 前端控制器
 * </p>
 *
 * @author ZhaoYuJie
 * @since 2025-04-18
 */
@RestController
@RequestMapping("/canteen")
public class CanteenController {
    @Autowired
    private CanteenMapper canteenMapper;

    /**
     * 获取所有食堂列表
     * 
     * @return 食堂列表
     */
    @GetMapping("/list")
    public Resp<List<Canteen>> list() {
        List<Canteen> list = canteenMapper.selectList(Wrappers.lambdaQuery(Canteen.class).eq(Canteen::getStatus, 1));
        return Resp.success(list);
    }
}
